<?php



namespace App\Http\Requests\Company;

use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;

class RecommendProductRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'products.*.product_type' => 'required',
            'products.*.product_id' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'products.*.product_type.required' => '产品类型字段是必填的。',
            'products.*.product_id.required' => '产品ID字段是必填的。'
        ];
    }

    public function filldata()
    {

        $user = Auth::user();
        return [

            'company_id' =>(int)$user['login_company_id'],
            'products'=>(array)$this->input('products',[]),

        ];
    }
}
